    //
//  SC_CurveChartVC.m
//  SCCharts
//
//  Created by Yang on 9/2/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "SC_CurveChartVC.h"


@implementation SC_CurveChartVC

- (id)init {
	if (self = [super init]) {
		dataArray = [[NSMutableArray alloc] init];
		forIpad = NO;
	}
	return self;
}
- (void)setViewFrame:(CGRect )frame {
	graphView = [[SC_CurveChartView alloc] initWithFrame:frame];
	self.view = graphView;
	
	// save the origin frame and size
	originFrame = frame;
}

- (void)setData:(NSArray *)array {
	[graphView setData:array];
}
- (void)setStandardValue:(float)value {
	[graphView setStandardValue:value];
}
- (void)setLowLimitedValue:(float )value {
	[graphView setLowLimitedValue:value];
}
- (void)setChartTitle:(NSString *)title {
	chartTitle = title;
	[chartTitle retain];
}
- (void)setForIpad {
	forIpad = YES;
}
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
}
*/


// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
	if (forIpad) {
		return NO;
	}
	
	if (interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
		self.view.frame = CGRectMake(0.0f, 0.0f, 480.0f, 300.0f);
		[graphView setTopMargin:40.0f];
		[graphView needShowTitle:chartTitle isShow:YES];
	}
	else {
		self.view.frame = originFrame;
		[graphView setTopMargin:15.0f];
		[graphView needShowTitle:chartTitle isShow:NO];
	}
//	CGRect rect = self.view.bounds;
//	[graphView.indicatorView resetFrame:rect];
	[self.view setNeedsDisplay];
    return YES;
}

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
	
	
	[graphView release];
	
	[dataArray release];
	
    [super dealloc];
}


@end
